package com.cn.gmall.weball.controller;

import com.cn.gmall.common.result.Result;
import com.cn.gmall.order.client.OrderFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.Mapping;

import javax.annotation.Resource;
import java.util.Map;

@Controller
public class OrderController {
    @Resource
    private OrderFeignClient orderFeignClient;



    /***
     * 我的订单
     *
     */
    @GetMapping("/myOrder.html")
    public String orderList(){
        return  "order/myOrder";
    }

    /**
     * 结算页数据显示
     *
     * @return
     */
    @GetMapping("trade.html")
    public String toTrade(Model model) {
//        获取结算页的数据
        Result<Map> result = orderFeignClient.toTrade();
//result.getData()是一个map对象
        model.addAllAttributes(result.getData());
        return "order/trade";
    }
}
